add_subdirectory(Core)
add_subdirectory(FiniteDiff)
add_subdirectory(Embedded)

add_library(${MAIN_LIB} STATIC ${Core_Files} ${FiniteDiff_Files} ${Embedded_Files})
target_include_directories(${MAIN_LIB} PUBLIC ./)

if(USE_MKL)
  target_link_libraries(${MAIN_LIB} -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl)
elseif(USE_AOCL)
  target_include_directories(${MAIN_LIB} PUBLIC ${AOCL_ROOT}/include)
  target_link_directories(${MAIN_LIB} PUBLIC ${AOCL_ROOT}/lib)
  target_link_libraries(${MAIN_LIB} PUBLIC lapacke flame blis-mt -no-pie)
elseif(USE_OPENBLAS)
    target_include_directories(${MAIN_LIB} PUBLIC ${OpenBLAS_INCLUDE_DIRS})
    target_link_libraries(${MAIN_LIB} PUBLIC ${OpenBLAS_LIBRARIES} pthread gfortran)
else()
    target_include_directories(${MAIN_LIB} PUBLIC ${BLAS_INCLUDE_DIRS} ${CBLAS_INCLUDE_DIRS} ${LAPACK_INCLUDE_DIRS} ${LAPACKE_INCLUDE_DIRS})
    target_link_directories(${MAIN_LIB} PUBLIC ${BLAS_LIBRARY_DIRS} ${CBLAS_LIBRARY_DIRS} ${LAPACK_LIBRARY_DIRS} ${LAPACKE_LIBRARY_DIRS})
    target_link_libraries(${MAIN_LIB} PUBLIC ${BLAS_LIBRARIES} ${CBLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${LAPACKE_LIBRARIES} gfortran)
endif()
